// 上传接口
const upload = require('../controllers/upload.js')
const multer = require('koa-multer')
const ueditor = require('koa2-ueditor')

module.exports = (router)=>{
  router.post("/upload/tx",multer({ dest: 'upload/tx' }).single('tx'),upload.tx)
  router.post("/upload/pic",multer({ dest: 'upload/pic' }).single('pic'),upload.pic)
  router.all("/upload/ueditor",ueditor(['upload', {
    "imageAllowFiles": [".png", ".jpg", ".jpeg"],
    "imagePathFormat": "/ueditor/{yyyy}{mm}{dd}/{filename}",  // 保存为原文件名
    "imageManagerListPath": "/ueditor/", //指定要列出图片的目录
    "imageManagerUrlPrefix": "/upload", //图片访问路径前缀
  }]))
}